<template>
  <div class="header">
    <div class="top container-1200 flex justify-between align-center">
        <img class="logo" src="../assets/image/index/logo.png" height="85" width="450"/>
        <div class="search"><input placeholder="请输入关键词"></div>
    </div>
    <div class="nav">
      <div class="container-1200 flex justify-between align-center flex-wrap">
        <div class="navItem flex justify-center align-center " :class="{'isChosed':choseId == 1}" @click="jumpPage(1)"><img src="../assets/image/index/home.png" height="20" width="21"/>首页</div>
        <div class="navItem flex justify-center align-center " :class="{'isChosed':choseId == 2}" @click="jumpPage(2)"><img src="../assets/image/index/edit.png" height="19" width="18"/>教育要闻</div>
        <div class="navItem flex justify-center align-center " :class="{'isChosed':choseId == 3}" @click="jumpPage(3)"><img src="../assets/image/index/gov.png" height="17" width="18"/>政务公开</div>
        <div class="navItem flex justify-center align-center " :class="{'isChosed':choseId == 4}" @click="jumpPage(4)"><img src="../assets/image/index/work.png" height="15" width="19"/>网上办事</div>
        <div class="navItem flex justify-center align-center " :class="{'isChosed':choseId == 5}" @click="jumpPage(5)"><img src="../assets/image/index/hudong.png" height="17" width="21"/>政民互动</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'xheader',
  data () {
    return {
      selectedOption:false,
      lan:'zh',
      language: {
          'zh': '中文',
          'en': 'English',
          'ko': '한글'
      },
      choseId: 1
    }
  },
  inject:['reload'],
  computed: {
    lang() {
      return this.language[this.getLocalStorage('lang')]||'中文';
    },
  },
  methods: {
    selectOption(){
      this.selectedOption = true;
    },
    selectd(val){
      this.lan = val
     // this.lang = val;
      window.localStorage.setItem('lang', val);
      this.selectedOption = false;
      this.$i18n.locale = this.getLocalStorage('lang')
      this.reload()
    },
    getLocalStorage(name) {
      if (window.localStorage.getItem(name) == null) {
        return '';
      } else {
        return window.localStorage.getItem(name);
      }
    },
    jumpPage(index){
      this.choseId = index;
      this.$emit('getNavId', this.choseId);
    }
  },
  watch: {
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
.header{
  overflow: hidden;
  width: 100%;
  position:relative;
  background-image: url("../assets/image/index/head-bg.png");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  .top{
    height: 150px;
  }
  .search{
    width: 290px;
    height: 30px;
    background-color: #ffffff;
    border-radius: 15px;
    border: 2px solid #2c64ff;
    opacity: 0.6;
    overflow: hidden;
    input{
      width: 100%;
      height: 100%;
      line-height: 30px;
      padding: 0 20px;
      border: none;
      font-size: 12px;
    }
  }
  .nav{
    width: 100%;
    height: 67px;
    background-image: linear-gradient(0deg,#3369ff 0%,#4979ff 50%,#3369ff 100%),linear-gradient(#255fff,#255fff);
    background-blend-mode: normal,normal;
    .navItem{
      width: 20%;
      height: 100%;
      line-height: 67px;
      border-right: 2px solid rgba(255,255,255,.42);
      font-size: 20px;
      text-align: center;
      color: #ffffff;
      cursor: pointer;
      font-weight: bold;
      &:hover{
        background: rgba(255,255,255,.42);
      }
      &.isChosed{
        background: #e3edff;
        color: #2c64ff;
      }
      img{
        margin-right: 10px;
      }
      &:first-child{
        border-left: 2px solid rgba(255,255,255,.42);
      }
    }
  }
}
@media screen and (max-width: 600px) {
  .logo{
    width: 80%;
    height: 56px;
    margin: auto;
  }
  .top{
    height: 80px !important;
  }
  .search{
    display: none;
  }
  .nav{
    height: 40px !important;
    .navItem{
      font-size: 14px !important;
      img{
        display: none;
      }
    }
  }
}
</style>
